home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / c_lib.arc / PCINVINT.C < prev    next >
Text File  |  1990-08-09  |  2KB  |  64 lines

  1. /**
  2. *
  3. *  Name         pcinvint -- Invoke a software interrupt service routine
  4. *
  5. *  Synopsis     ercode = pcinvint(intype,preg);
  6. *               int ercode          Return error code
  7. *               int intype          Interrupt type
  8. *               struct dreg *preg   Pointer to register structure
  9. *
  10. *  Description  This function invokes the interrupt service routine
  11. *               associated with the interrupt type intype.  Information
  12. *               may be passed to the service routine via values in the
  13. *               register structure, and the service routine may alter
  14. *               this values for return.  Because interrupt type 70 (hex)
  15. *               is used by the Macro Assembler function to invoke the
  16. *               specified interrupt, it cannot be defined as a user interrupt.
  17. *               This function should not be used to access the BIOS or DOS
  18. *               functions because error checking and register setting
  19. *               are not performed.  For example, the stack segment and pointer
  20. *               are not saved.  It is intended to invoke user defined software
  21. *               interrupt service routines.  Use the TOOLS function BIOS and
  22. *               the TOOLS 2 function DOS to access the BIOS and DOS functions.
  23. *
  24. *  Returns      ercode            The returned error code.  If the interrupt
  25. *                                 type is 70 1 is returned; otherwise 0.
  26. *               preg              The values of the registers may be altered
  27. *                                 by the service routine associated with the
  28. *                                 interrupt type.
  29. *
  30. *  Version      1.1  (C)Copyright Blaise Computing Inc.  1983, 1984
  31. *
  32. **/
  33. struct dreg
  34. {
  35.   unsigned ax,bx,cx,dx,si,di,ds,es;
  36. };
  37. #define DOSREG  struct dreg
  38.  
  39. struct segads                          /* Offset, segment address type */
  40. {
  41.   unsigned r;
  42.   unsigned s;
  43. };
  44. #define ADS     struct segads          /* Abbreviation                 */
  45.  
  46. int pcinvint(intype,preg)
  47. int intype;
  48. DOSREG *preg;
  49. {
  50.  
  51.     ADS int_vector;
  52.     int pcretvec(),pcsetvec(),invint();
  53.  
  54.     if (intype == 0x70)
  55.        return(1);                      /* 70 is used by C TOOLS 2      */
  56.  
  57.     pcretvec(intype,&int_vector);      /* Get the address of ISR       */
  58.     pcsetvec(0x70,&int_vector);        /* Set interrupt 70             */
  59.     invint(preg);                      /* Invoke the interrupt         */
  60.  
  61.     return(0);
  62.  
  63. }
  64.